// web/src/app/(employee)/employee/page.tsx
import React from 'react';
import {db} from "@/lib/db";
import EmployeeNavbar from "@/app/(employee)/employee/[id]/_components/employee-navbar";
import {Employee} from "@/lib/employee/type";
import EmployeeContent from "@/app/(employee)/employee/[id]/_components/employee-content";
import EmployeeCompanyCard from "@/app/(employee)/employee/[id]/_components/employee-company-card";
import {Company, Hr} from "@prisma/client";

const Page = async ({
                        params
                    }: {
    params: { id: string }
}) => {
    const id = params.id;
    const employee = await db.employee.findUnique({
        where: {id},
        include: {
            education: true,
            tags: true,
            city: true,
            company: true,
            hr: true
        }
    })

    return (
        <div className={`h-full bg-blue-200/20 pb-4`}>
            {/*navbar*/}
            <EmployeeNavbar
                employee={employee as Employee}
            />
            {/*@ts-ignore*/}
            <EmployeeContent
                employee={employee as Employee & { hr: Hr }}
            />
            <EmployeeCompanyCard
                company={employee?.company as Company}
            />
        </div>
    );
};

export default Page;